package br.com.massai.model.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;

import br.com.massai.view.enums.PerfilEnum;

@Entity
@SequenceGenerator(name = "seqUsuario", sequenceName = "seq_usuario", allocationSize = 1)
@NamedQueries({@NamedQuery(name = "Usuario.findAll", query = "SELECT u FROM Usuario u")})
public class Usuario implements Serializable {

	private static final long serialVersionUID = 18577365964755933L;

	@Id
	@Column(name = "ID_USUARIO")
	@GeneratedValue(generator = "seqUsuario", strategy = GenerationType.SEQUENCE)
	private Long id;

	@Column(name = "LOGIN", length = 20, nullable = false, unique = true, columnDefinition = "VARCHAR(20)")
	private String login;

	@Column(name = "SENHA", nullable = false, columnDefinition = "TEXT")
	private String senha;

	@Column(name = "NOME", nullable = false, columnDefinition = "VARCHAR(100)")
	private String nome;

	@Enumerated(EnumType.ORDINAL)
	@Column(name = "PERFIL", nullable = false)
	private PerfilEnum perfil;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getSenha() {
		return senha;
	}

	public void setSenha(String senha) {
		this.senha = senha;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public PerfilEnum getPerfil() {
		return perfil;
	}

	public void setPerfil(PerfilEnum perfil) {
		this.perfil = perfil;
	}
}
